<template>
	<uni-popup ref="popup" type='center' :mask-click="false" :is-mask-click="false">
		<view class="modal">
			<image src="../static/images/default/permision-bg.png"></image>
			<view class="h1">
				<text>开启权限通知</text>
			</view>
			<view class="h2">
				<text>请前往应用权限设置页，手动开启{{perName}}功能</text>
			</view>
			<view class="btn-box flex">
				<text @click="close">取消</text>
				<text @click="go">前往设置</text>
			</view>
		</view>
	</uni-popup>
</template>




<!-- 
	安卓端权限permissionID
	android.permission.ACCESS_FINE_LOCATION		位置权限
	android.permission.ACCESS_COARSE_LOCATION	模糊位置权限(蓝牙\ble依赖)
	android.permission.CAMERA					摄像头权限
	android.permission.READ_EXTERNAL_STORAGE	外部存储(含相册)读取权限
	android.permission.WRITE_EXTERNAL_STORAGE	外部存储(含相册)写入权限
	android.permission.RECORD_AUDIO				麦克风权限
	android.permission.READ_CONTACTS			通讯录读取权限
	android.permission.WRITE_CONTACTS			通讯录写入权限
	android.permission.READ_CALENDAR			日历读取权限
	android.permission.WRITE_CALENDAR			日历写入权限
	android.permission.READ_SMS					短信读取权限
	android.permission.SEND_SMS					短信发送权限
	android.permission.RECEIVE_SMS				接收新短信权限
	android.permission.READ_PHONE_STATE			获取手机识别码等信息的权限
	android.permission.CALL_PHONE				拨打电话权限
	android.permission.READ_CALL_LOG			获取通话记录权限 
 -->

<script>
	import permision from "@/js_sdk/wa-permission/permission.js"
	export default {
		data() {
			return {
				
			};
		},
		onLoad({permissionID}) {
			this.permissionID = permissionID
		},
		mounted() {
			setTimeout(() => {
				this.$refs.popup.open()
			}, 1)
		},
		computed:{
			perName(){
				return {
					'android.permission.ACCESS_FINE_LOCATION':		'位置权限',
					'android.permission.ACCESS_COARSE_LOCATION':	'位置权限',			//(蓝牙\ble依赖)
					'android.permission.CAMERA':					'摄像头权限',
					'android.permission.READ_EXTERNAL_STORAGE':		'手机存储读取权限',   	//(含相册)读取权限
					'android.permission.WRITE_EXTERNAL_STORAGE':	'手机存储权限',   	//(含相册)写入权限
					'android.permission.RECORD_AUDIO':				'麦克风权限',
					'android.permission.READ_CONTACTS':				'通讯录读取权限',			//读取
					'android.permission.WRITE_CONTACTS':			'通讯录权限',			//写入
					'android.permission.READ_CALENDAR':				'日历读取	权限',			//读取	
					'android.permission.WRITE_CALENDAR':			'日历权限',			//写入	
					'android.permission.READ_SMS':					'短信读取权限',
					'android.permission.SEND_SMS':					'短信发送权限',
					'android.permission.RECEIVE_SMS':				'接收新短信权限',
					'android.permission.READ_PHONE_STATE':			'获取手机识别码等信息权限',
					'android.permission.CALL_PHONE':				'拨打电话权限',
					'android.permission.READ_CALL_LOG':				'获取通话记录权限',
				}[this.permissionID] ||'相应权限'
			},
		},
		// onBackPress(e) {
		// 	if (e.from == "backbutton") return true; //APP安卓物理返回键逻辑
		// },
		onHide() {
			this.close();
		},
		methods: {
			close() {
				this.$refs.popup.close();
				this.Jump()
			},
			go() {
				permision.gotoAppPermissionSetting()

			},
		},
	}
</script>
<style lang="scss">
	page {
		background: transparent;
	}

	.modal {
		text-align: center;
		background: #FFFFFF;
		border-radius: 20rpx;
		width: 586rpx;
		image {
			width: 100%;
			height: 326rpx;
		}

		.h1 {
			padding: 36rpx 0 26rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #1A1A1A;
		}

		.h2 {
			padding-bottom: 40rpx;

			text {
				display: inline-block;
				max-width: 80%;
				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #999999;
			}

		}

		.btn-box {
			border-top: 1rpx solid #EEEEEE;

			text {
				display: block;
				flex: 1;
				padding: 22rpx 0;
				text-align: center;

				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #999999;
			}

			text:nth-of-type(2) {
				color: #FA2B47;
				;
				border-left: 1rpx solid #EEEEEE;
			}
		}
	}
</style>
